import i18n from '@/i18n'
import { hasPermission } from '@/utils'
import { RenderName, RenderJira, RenderStatus, RenderBussinessType } from './element'
import { timeFormat } from '@/components/storybook/utilties/tools'

export const renderColumns = () => [
  {
    field: 'name',
    headerText: i18n.t('custom.reports.name'),
    width: 250,
    template: RenderName
  },

  {
    field: 'description',
    headerText: i18n.t('custom.accounting.description'),
    width: 250,
    clipMode: 'EllipsisWithTooltip'
  },

  {
    headerText: i18n.t('custom.reports.integration'),
    width: 130,
    field: 'integrations',
    clipMode: 'EllipsisWithTooltip'
  },
  {
    field: 'businessType',
    headerText: i18n.t('custom.reports.businessType'),
    width: 100,
    template: RenderBussinessType
  },
  {
    field: 'status',
    headerText: i18n.t('custom.dataset.status'),
    width: 100,
    template: RenderStatus
  },
  {
    field: 'pageViews',
    headerText: i18n.t('custom.reports.pageviews'),
    width: 160

  },
  {
    field: 'creatorName',
    headerText: i18n.t('custom.reports.creatorName'),
    width: 100

  },
  {
    field: 'createDate',
    headerText: i18n.t('custom.reports.createDate'),
    width: 180,
    format: (value) => timeFormat(value)

  },
  {
    field: 'updateByName',
    headerText: i18n.t('custom.reports.lastModifiedBy'),
    width: 150
  },
  {
    field: 'updateDate',
    headerText: i18n.t('custom.reports.updateDate'),
    width: 170,
    format: (value) => timeFormat(value)

  },
  {
    field: 'jiraNumber',
    headerText: i18n.t('custom.reports.jiraNumber'),
    width: 120,
    clipMode: 'EllipsisWithTooltip',
    template: RenderJira,
    visible: hasPermission('sys:reports:internalNotes')
  },
  {
    field: 'poName',
    headerText: i18n.t('custom.reports.poName'),
    width: 80,
    clipMode: 'EllipsisWithTooltip',
    visible: hasPermission('sys:reports:internalNotes')
  },
  {
    field: 'daName',
    headerText: i18n.t('custom.reports.daName'),
    width: 80,
    clipMode: 'EllipsisWithTooltip',
    visible: hasPermission('sys:reports:internalNotes')
  }
]

export const optionList = Object.freeze([
  {
    value: 'Pending',
    label: 'Pending'
  },
  {
    value: 'In Progress',
    label: 'In Progress'
  }, {
    value: 'Waiting for Dev',
    label: 'Waiting for Dev'
  },
  {
    value: 'Done',
    label: 'Done'
  }
])
export const uatList = Object.freeze([
  {
    value: 'Pending',
    label: 'Pending'
  },
  {
    value: 'Awaiting Response',
    label: 'Awaiting Response'
  }, {
    value: 'With Feedback',
    label: 'With Feedback'
  },
  {
    value: 'Done',
    label: 'Done'
  }
])

export const sortFields = Object.freeze([
  {
    value: 'name',
    label: 'Name'
  },
  {
    value: 'status',
    label: 'Status'
  },
  {
    value: 'business_type',
    label: 'Type'
  },
  {
    value: 'create_date',
    label: 'Created Date'
  },

  {
    value: 'update_date',
    label: 'Last Modified'
  }

])

export const community = {
  dictLabel: 'Community',
  dictType: null,
  dictValue: 'Community',
  getStartedAboutId: null,
  id: '',
  sort: null,
  subjectCode: '',
  tenantCode: null
}
